import request from '@/utils/request'

/**
 * 获取日常活动数据
 * @returns {Promise} 日常活动数据
 */
export const getDailyActivities = () => {
  return request.get('/api/health/daily-activities')
}

/**
 * 添加日常活动数据
 * @param {Object} data - 日常活动数据
 * @param {number} data.steps - 步数
 * @param {number} data.calories_burned - 消耗卡路里
 * @param {number} data.distance - 距离
 * @param {number} data.active_minutes - 活动分钟数
 * @param {string} data.recorded_at - 记录时间
 * @returns {Promise} 添加结果
 */
export const addDailyActivities = (data) => {
  return request.post('/api/health/daily-activities', data)
}

/**
 * 更新日常活动数据
 * @param {string} id - 数据ID
 * @param {Object} data - 日常活动数据
 * @returns {Promise} 更新结果
 */
export const updateDailyActivities = (id, data) => {
  return request.put(`/api/health/daily-activities/${id}`, data)
}

/**
 * 删除日常活动数据
 * @param {string} id - 数据ID
 * @returns {Promise} 删除结果
 */
export const deleteDailyActivities = (id) => {
  return request.delete(`/api/health/daily-activities/${id}`)
}

export default {
  getDailyActivities,
  addDailyActivities,
  updateDailyActivities,
  deleteDailyActivities,
}
